package com.javashow.main.factory.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.javashow.main.factory.service.IModelFactoryService;

@Controller
@RequestMapping("/modelFactory")
public class ModelFactoryController {
	
	@Autowired
	private IModelFactoryService modelFactoryService;
	
	@RequestMapping("/getModelByName")
	public @ResponseBody String getModelByName(HttpServletRequest request) {
		String result = null;
		
		String modelName = request.getParameter("modelName");
		result = modelFactoryService.getModelByName(modelName).toString();
			/*"[" + 
					"{name : 'code',   		type : 'string'}," + 
					"{name : 'name', 		type : 'string'}," + 
					"{name : 'manager', 		type : 'string'}," + 
					"{name : 'description', 	type : 'string'}" + 
				"]";*/
//System.out.println(result);
		return result;
	}
}
